package com.example.juc.test;

public class Ticket {

    private int num = 40;

    public synchronized void sale(){
        if(num>0){
            System.out.println(Thread.currentThread().getName()+"卖出了"+num--+"票，剩余"+num);
        }
    }
}
